package demo;

import com.sun.corba.se.spi.orb.OperationFactory;

public class Test {

    public static void main(String[] args) {
        //加法
        IFactory addFactory = new AddFactory();
        Operation add = addFactory.createOption();
        add.setValue1(1);
        add.setValue2(1);
        System.out.println(add.getResult());

        //减法
        IFactory subFactory = new SubFactory();
        Operation sub = subFactory.createOption();
        sub.setValue1(3);
        sub.setValue2(2);
        System.out.println(sub.getResult());

        //乘法
        IFactory mulFactory = new MulFactory();
        Operation mul = mulFactory.createOption();
        mul.setValue1(3);
        mul.setValue2(4);
        System.out.println(mul.getResult());

        //除法
        DivFactory divFactory = new DivFactory();
        Operation div = divFactory.createOption();
        div.setValue1(3);
        div.setValue2(1);
        System.out.println(div.getResult());
    }
}
